Upgrade MUI to v5; replace material-table and react-swipeable-views#1
Closed
ankit0504 wants to merge 11 commits intoagupta/upgrade-phase-3-react-17from
Closed
Upgrade MUI to v5; replace material-table and react-swipeable-views#1ankit0504 wants to merge 11 commits intoagupta/upgrade-phase-3-react-17from
ankit0504 wants to merge 11 commits intoagupta/upgrade-phase-3-react-17from
Conversation
Mechanical rename of @material-ui/core, @material-ui/lab, and @material-ui/styles imports to their @mui/* equivalents. Adds Emotion (MUI v5's default styling engine) and keeps @mui/styles as a JSS shim so the existing makeStyles/withStyles call sites keep working. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
react-swipeable-views was used in exactly one place (SearchTabs.tsx) to wrap two TabPanel children. Removed the swipe affordance and let TabPanel's existing index/value gating handle which pane is shown. The library is unmaintained and incompatible with React 17+. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
material-table is unmaintained and incompatible with MUI v5. Swap it for @mui/x-data-grid (community) which covers filtering, sorting, column visibility, pagination, and quick filter out of the box. Notable behavior changes: - The "click cell to filter by its value" interaction is dropped. It was implemented via material-table's imperative dataManager API and has no clean Data Grid equivalent. Filters are now driven by the built-in column filter UI plus the quick-filter search box. - The MediaColumnFilter checkbox is reimplemented as a custom GridFilterOperator on the Audio/Video columns. - Custom CSV/PDF export buttons (exporting.ts) are no longer wired up in the toolbar. CSV is available via the column menu; if PDF export is still needed it can be re-added as a slot button later. - Sticky first/second columns are dropped — Data Grid pinning is a Pro feature and the actions columns work fine without it. Move clsx, filefy, history, jspdf, jspdf-autotable, and mapbox-gl from peerDependencies (where yarn auto-installed them) into regular dependencies. With material-table removed they're no longer pulled transitively. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The codemod handles renames but leaves several v5 API changes for
manual cleanup:
- theme: replace post-creation `customTheme.overrides = {...}` with
the v5 `components: { ComponentName: { styleOverrides: {...} } }`
shape passed into a second createTheme call.
- ProvidersWrap: import Theme/StyledEngineProvider from
@mui/material/styles (not @mui/styles, which no longer re-exports
them in v5).
- palette.text.hint is removed in v5 — swap to palette.text.disabled.
- Autocomplete renderOption: new signature receives (props, option),
so wrap children in <li {...props}>.
- BottomNavigationAction: drop the `wrapper` and `label` class slots
(no longer part of the component's classes shape).
- Fab: drop the `label` class slot and inline its sizing on root.
- TimelineDot: variant `'default'` is gone, use `'filled'`.
- ToggleButton: remove non-standard `color="blue"`; the default works.
- Slide TransitionComponent: children must be required, not optional.
- Demo files: minor typing fixes for ClickAwayListener and Select
onChange handlers.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ns buttons The previous commit dropped the export buttons because Data Grid doesn't expose a custom format hook the way material-table did, but the existing exporting.ts utilities still work — they just need to be called with the currently-visible rows from apiRef. Pass the column config through slot props. Also surface Data Grid's built-in Filters and Columns toggles in the toolbar. They were technically reachable through each column's hover-only menu, which was hard to find. Inline the localIndicator styles in LocalColumnTitle to avoid an import cycle (config -> LocalColumnTitle -> ResultsToolbar -> exporting -> config) introduced by the toolbar now needing exporting.ts. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Data Grid uses a fixed row height by default. Cells with multiple values per row (Country with two flags, Endonym wrapping non-Latin scripts, etc.) were getting clipped and bleeding into adjacent rows. Setting getRowHeight to 'auto' lets each row grow to fit its tallest cell; getEstimatedRowHeight keeps virtualization fast on the 1000+ row dataset. Cell content is top-aligned so single-line columns line up cleanly with multi-line ones. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The MediaFilterInput rendered the checkbox too high because the default FormControlLabel doesn't share Data Grid's filter input baseline. Bottom-align it and pull the original 'http' marker color in via the secondary palette so the checkbox tone matches the other filter controls. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Data Grid's free tier (community v6) hard-codes disableMultipleColumnsFiltering: true, so users could only filter on one column at a time. Multi-column filtering is paywalled to the Pro plan in v6, and v5 — the last version that had it free — was last released March 2023 and is no longer maintained. TanStack Table v8 is headless and actively maintained, supports React 16/17/18+, and its filter model has no paywall. The trade-off is that we render the table primitives ourselves with MUI Table / TableHead / TableBody, which lets us bring back material-table's per-column filter row UX (text input by default, Select for lookup columns, the Has-media checkbox for Audio/Video). Other features carried over: - Global search box (matches across visible columns) - Column visibility menu in the toolbar - CSV / PDF export wired to filtered+sorted rows - "View in map" and "Clear filters" buttons unchanged Column config moved to TanStack column defs via createColumnHelper. Cell renderers now receive a CellContext and read row.original; filter logic for Audio/Video lives in mediaUrlFilterFn. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
React throws when a function passed to flexRender returns undefined. Several columns (Glottocode, ISO 639-3, Additional Neighborhoods, Endonym, etc.) are nullable in the dataset, and their default cell renderers were `info.getValue()` — which returns undefined for any row where the field is missing. Coerce all simple-text cells with ?? '' and add a guard in renderCountryColumn / renderEndoColumn for rows without those fields. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The column header already says "Audio" / "Video"; the checkbox in the filter row beneath it is unambiguous. Replace the labelled FormControlLabel with a bare Checkbox and put the explanatory text in the title attribute for hover discoverability. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The toolbar was passing the static column config to exportCsv/exportPdf regardless of which columns the user had hidden via the column visibility menu. Filter the config by columnVisibility before handing it to the export utilities so a downloaded CSV/PDF reflects exactly what's on screen. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Owner
Author
|
Reopening against upstream Language-Mapping/language-map. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 4 of the dependency-upgrade series, stacked on Language-Mapping#306 (phase 3, React 17). This is the big one:
@material-ui/*packages renamed to@mui/*, Emotion installed as the styling engine, JSS-stylemakeStyleskept via the official@mui/stylesshim so the 91 v4-style files don't all need rewriting.material-tableremoved. It's unmaintained and never got a real MUI v5-compatible release. Replaced with@tanstack/react-tablerendering MUI Table primitives.react-swipeable-viewsremoved. Was used in exactly one place. Replaced with plain MUI Tabs.Why TanStack Table over the alternatives
The grid replacement was the biggest decision in this PR. Considered, in order:
disableMultipleColumnsFiltering: trueis hard-coded in community v6. With material-table users routinely set multiple per-column filters, single-column-only is a real regression.material-table@2.0.6react-beautiful-dnd, and locks us out of React 18+. We'd just have to redo this migration in phase 5.Behavior changes vs. the old material-table
Preserved
Size/Status, "Has media" checkbox forAudio/Video)Gone
dataManagerAPI. Could be re-added on top of TanStack with a customonCellClicklater if missed.Test plan